﻿Public Class FrmRegister

    Private Sub Submit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Submit.Click
        Dim name As String = UserName.Text
        Dim password As String = Pwd.Text
        Dim confirmPassWord As String = ConfirmPwd.Text
        Dim lv As String = Level.SelectedItem.ToString
        Dim sql As String = "select * from userInfo where UName=" & "'" & name & "'"
        Dim ds As DataSet = New DataSet
        'Dim cnStr As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source= Tool\user.accdb;Persist Security Info=False;Jet OLEDB:Database Password='1234'"
        ds = SearchMysql(sql)
        If ds.Tables(0).Rows.Count > 0 Then
            MsgBox("用户名已经存在！")
        ElseIf name = "" Then
            MsgBox("用户名不能为空！")
        ElseIf password = "" Then
            MsgBox("密码不能为空！")
        ElseIf password <> confirmPassWord Then
            MsgBox("两次输入的密码不一样！")
        Else
            Dim sql1 As String = "insert into userInfo(UName,UPwd,UPriority) values(" & "'" & name & "'" & "," & "'" & password & "'" & "," & lv & ")"
            'Dim cnStr1 As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source= Tool\user.accdb;Persist Security Info=False;Jet OLEDB:Database Password='1234';"
            HandleMysql(sql1)
            MsgBox("注册成功！")
        End If

    End Sub

    Private Sub FrmRegister_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Level.SelectedIndex = 2
        ' Me.PictureBox1.Controls.Add(Label_1)
    End Sub

    Private Sub Reset_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Reset.Click
        UserName.Clear()
        Pwd.Clear()
        ConfirmPwd.Clear()
        Level.SelectedIndex = 2
    End Sub

    Private Sub Submit_MouseHover(sender As Object, e As EventArgs) Handles Submit.MouseHover
        'Submit.BackColor = Color.Aqua
    End Sub
End Class